package com.example.test.api.config;

import com.example.test.api.interceptor.TokenInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class CustomWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //配置APP端接口拦截请求
        registry.addInterceptor(new TokenInterceptor()).addPathPatterns("/**")
                .excludePathPatterns("/", "/swagger-ui.html", "/webjars/**", "/swagger-resources/**", "/v2/**",
                        "/swagger-ui.js", "/api-docs", "/api-docs/**", "/css/**", "/fonts/**", "/images/**", "/lib/**", "/lang/**", "/helloBoot");
    }
}
